#include-once

; =================================
; 
; returns a 3-index array containing;
; 	0: Computer model
;	1: Serial Number
;	2: BIOS Version
;
; =================================

func _biosInfo()

; init object variables
dim $objWMIService, $colBios, $colCSP
; init array we'll return
dim $info[3]

; get the WIM object
$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
; perform a query in win32_bios and computersystemproduct
$colBios = $objWMIService.execquery("Select * From Win32_BIOS")
$colCSP = $objWMIService.execquery("Select * from Win32_ComputerSystem")

; go through the list of fields and grab the serial and BIOS version
for $objBios in $colBios
	$info[1] = $objBios.SerialNumber
	$info[2] = $objBios.SMBIOSBIOSVersion
Next

; do the same for the computer model
for $objCSP in $colCSP
	$info[0] = $objCSP.Model
Next

; Strip whitespace from end of model string
$info[0] = StringStripWS($info[0], 2)
; strip all whitespace from serial and bios ver
$info[1] = StringStripWS($info[1], 8)
$info[2] = StringStripWS($info[2], 8)

Return $info

EndFunc

func _getDN($compName)
	Dim $objTrans, $objDomain
	Dim $wshNetwork = ObjCreate("WScript.Network")
	Const $ADS_NAME_TYPE_1779 = 1
    Const $ADS_NAME_INITTYPE_GC = 3
    Const $ADS_NAME_TYPE_NT4 = 3
    
    $objTranslate = ObjCreate("NameTranslate")
    $objDomain = ObjGet("LDAP://rootDse")
    $objTranslate.Init($ADS_NAME_INITTYPE_GC, "")
    $objTranslate.Set($ADS_NAME_TYPE_NT4, $wshNetwork.UserDomain & "\" & $compName & "$")
    $compDN = $objTranslate.Get($ADS_NAME_TYPE_1779)
    ;Set DN to upper Case
    $compDN = StringUpper($compDN)

	Return $compDN

EndFunc